import redis
import logging

class Config(object):
    SECRET_KEY = "eJApk/BPOatqbvOvA33P3uKxs3N/MfGuN6yCsRN+NQ1KladCaIZQRbiXxGbfUT75"

    SQLALCHEMY_DATABASE_URI = "mysql://root:mysql@127.0.0.1:3306/information"
    SQLALCHEMY_TRACK_MODIFICATIONS = True
    # redis 配置
    REDIS_HOST = "127.0.0.1"
    REDIS_POST = "6379"
    # flask_session 的配置 存储到redis更快捷方便
    SESSION_TYPE = "redis"
    SESSION_USE_SIGNER = True
    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST, port=REDIS_POST)
    PERMANENT_SESSION_LIFETIME = 86400  # session 有些时间 以秒为单位
    SQLALCHEMY_COMMIT_ON_TEARDOWN = True

    LOG_LEVEL = logging.DEBUG

class DevelopmentConfig(Config):
    DEBUG = True
class ProductionConfig(Config):
    DEBUG = False
    LOG_LEVEL = logging.WARNING
class TestingConfig(Config):
    DEBUG = True
    TESTING = True

config = {
    'development' :DevelopmentConfig,
    'production' : ProductionConfig,
    'testing': TestingConfig
}